import request from '@/utils/request'

interface LoginResponse {
  token: string
  user: {
    id: number
    email: string
    name: string
  }
}

export const authApi = {
  /**
   * 用户登录
   * @param email 邮箱
   * @param password 密码
   * @param rememberMe 是否记住我
   */
  login(email: string, password: string, rememberMe: boolean = false) {
    return request.post<LoginResponse>('/auth/login', {
      email,
      password,
      rememberMe
    })
  },

  /**
   * 用户登出
   */
  logout() {
    return request.post('/auth/logout')
  },

  /**
   * 获取当前用户信息
   */
  getCurrentUser() {
    return request.get<LoginResponse['user']>('/auth/me')
  }
} 